import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpAddress {
  id!: number;
  userId!: number;
  name!: string;
  phone!: string;
  provinceId!: number;
  province!: string;
  cityId!: number;
  city!: string;
  districtId!: number;
  district!: string;
  detail!: unknown;
  isDefault: boolean = false;
  addTime!: string;
  updateTime!: string;
  uniacid!: number;
}

export const ImsYzdKpAddressSchema = new EntitySchema({
  class: ImsYzdKpAddress,
  properties: {
    id: { primary: true, type: 'number' },
    userId: { type: 'number', index: 'user_id' },
    name: { type: 'string', length: 255 },
    phone: { type: 'string', length: 255 },
    provinceId: { type: 'number' },
    province: { type: 'string', length: 255 },
    cityId: { type: 'number' },
    city: { type: 'string', length: 255 },
    districtId: { type: 'number' },
    district: { type: 'string', length: 255 },
    detail: { type: 'unknown', columnType: 'longtext' },
    isDefault: { type: 'boolean', default: false, index: 'is_default' },
    addTime: { type: 'string', length: 255 },
    updateTime: { type: 'string', length: 255 },
    uniacid: { type: 'number' },
  },
});
